<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />


<atleap:content identifier="information" ignore="true" />

<script type="text/javascript">
    var slideshow = new Slideshow('slideshowAElem', 'slideshowImgElem', 'slideshowTitleElem', 'slideshowCountElem', 5000, 'slideshow');
</script>

<c:set var="firstSrc" value="" />
<c:set var="firstDescription" value="" />
<c:set var="firstLink" value="" />
<c:set var="imagesNumber" value="0" />
<script type="text/javascript">
    <atleap:resourceIterator var="resource" uriPrefix="/rw/resource/slideshow/" orderBy="r.uri">
        <c:set var="imagesNumber" value="${imagesNumber + 1}" />
        <atleap:rewriteUrl href="${resource.uri}" var="src" />
        <atleap:fieldValue valueMap="${resource.description}" var="description" filter="true" />
        <c:if test="${empty firstSrc}">
            <c:set var="firstSrc" value="${src}" />
            <c:set var="firstDescription" value="${description}" />
            <c:set var="firstLink" value="${resource.altUrl}" />
        </c:if>
        slideshow.addImage('${src}', '${resource.altUrl}', '${description}');
    </atleap:resourceIterator>
</script>
<div class="slideShow">
    <div>
        <atleap:message key="core.demo.slideshow.image" />
        <span id="slideshowCountElem">1</span>
        <atleap:message key="core.demo.slideshow.of" />
        ${imagesNumber}
    </div>
    <div>
        <a id="slideshowAElem" href="${firstLink}" target="_blank" title="${firstDescription}">
            <img id="slideshowImgElem" src="${firstSrc}" alt="${firstDescription}" width="350" height="286" border="0" />
        </a>
        <br/>
        <div id="slideshowTitleElem">
            ${firstDescription}
        </div>
    </div>
    <div>
        <atleap:message key="core.demo.slideshow.prevImage" var="prevMsg" />
        <a href="#" onclick="return slideshow.manualPrev();" title="${prevMsg}">
            ${prevMsg}
        </a>
        &nbsp;
        <atleap:message key="core.demo.slideshow.nextImage" var="nextMsg" />
        <a href="#" onclick="return slideshow.manualNext();" title="${nextMsg}">
            ${nextMsg}
        </a>
    </div>
</div>
<script type="text/javascript">
    slideshow.start();
</script>